﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Web.Controllers
{
    public class CompanyController : CommonController
    {
        //
        // GET: /Company/

        public ActionResult Index(string search)
        {
            var data = EdexContext.GetCompanies(search);
            return View(data);
        }

        public ActionResult Details(Guid id)
        {
            var data = EdexContext.GetCompanyDetails(id);

            return View(data);
        }

        public ActionResult FindAndReturnHtmlList(string id)
        {
            var data = EdexContext.GetCompanies(id);
            var result_string = String.Join(String.Empty, data.Select(r => String.Format("<option value='{0}'>{1}</option>", r.GUID_RECORD, r.COMPANY_NAME)));

            return Content(result_string);
        }
    }
}
